package com.smartscreen.baseinfomanage.controller;

import com.smartscreen.baseinfomanage.dto.CreateVenueRequest;
import com.smartscreen.baseinfomanage.entity.Venue;
import com.smartscreen.baseinfomanage.service.VenueService;
import com.smartscreen.common.response.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/base")
public class VenueController {

    @Autowired
    private VenueService venueService;

    @GetMapping("/venues")
    public ApiResponse<List<Venue>> getAllVenues() {
        List<Venue> venues = venueService.getAllVenues();
        return ApiResponse.success(venues);
    }

    @PostMapping("/venues")
    public ApiResponse<Map<String, String>> createVenue(@RequestBody CreateVenueRequest request) {
        String venueId = venueService.createVenue(request);
        return ApiResponse.created("创建成功", Map.of("venueId", venueId));
    }

    @PostMapping("/venues/batch")
    public Map<String, Map<String, Object>> getVenuesBatch(@RequestBody List<String> venueIds) {
        return venueService.getVenuesBatchAsMap(venueIds);
    }
}